:root {
    --color-background-gradient-start: hsl(209deg 40% 50%);
    --color-background-gradient-end: hsl(210deg 48% 69%);

    @media (prefers-color-scheme: dark) {
        --color-background-gradient-start: hsl(209deg 63% 40%);
        --color-background-gradient-end: hsl(238deg 28% 50%);
    }
}

.portico-pricing {
    --font-ss3: "Source Sans 3 VF", sans-serif;
    --font-ops: "Open Sans Variable", sans-serif;
    --color-background-box: hsla(210deg 44% 92%);
    --color-background-box-muted: hsl(0deg 0% 100% / 50%);
    --color-plan-tab-header: hsl(223deg 40% 30%);
    --color-plan-tab-copy: hsl(223deg 40% 25% / 70%);
    --color-box-header: hsl(223deg 43% 25%);
    --color-box-copy: hsl(223deg 43% 25%);
    --color-box-copy-fine-print: hsl(223deg 43% 55%);
    --color-link: hsl(210deg 94% 42%);
    --color-link-hover: hsl(210deg 100% 50%);
    --color-link-underline: hsl(210deg 94% 42% / 30%);
    --color-link-underline-hover: hsl(210deg 100% 50%);
    --color-link-underline-alternate: hsl(210deg 94% 100% / 40%);
    --color-link-underline-alternate-hover: hsla(210deg 94% 100% / 80%);
    --icon-left-outward-tab-curve: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3e%3cpath fill='white' d='M0 16h16V0c0 8.837-7.163 16-16 16Z'/%3e%3c/svg%3e");
    --icon-right-outward-tab-curve: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3e%3cpath fill='white' d='M16 16H0V0c0 8.837 7.163 16 16 16Z'/%3e%3c/svg%3e");
    --icon-question-header-swoosh: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='33' height='56' fill='none' viewBox='0 0 33 56'%3e%3cpath fill='%23E2EBF4' d='M33 37 1 56C1 35-3.5 0 33 0 7.5 3 7.776 37 33 37Z'/%3e%3c/svg%3e");
    --icon-current-plan-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' viewBox='0 0 22 22'%3e%3cg fill='%230F8544'%3e%3cpath d='M14.396 9.813a.914.914 0 1 0-1.293-1.293l-3.02 3.02-1.186-1.186a.914.914 0 1 0-1.294 1.293l1.834 1.833a.914.914 0 0 0 1.293 0l3.666-3.667Z'/%3e%3cpath fill-rule='evenodd' d='M11 .923a4.58 4.58 0 0 0-3.495 1.62 4.581 4.581 0 0 0-4.961 4.949 4.58 4.58 0 0 0 0 7.016 4.58 4.58 0 0 0 4.96 4.949 4.583 4.583 0 0 0 7.003-.001 4.582 4.582 0 0 0 4.95-4.96 4.583 4.583 0 0 0 0-6.991 4.58 4.58 0 0 0-4.962-4.962A4.581 4.581 0 0 0 11 .923ZM9.678 3.09a2.752 2.752 0 0 1 3.64.932.914.914 0 0 0 .972.4 2.752 2.752 0 0 1 3.289 3.288.914.914 0 0 0 .4.971 2.753 2.753 0 0 1 0 4.638.914.914 0 0 0-.4.97 2.752 2.752 0 0 1-3.283 3.29.914.914 0 0 0-.97.401 2.75 2.75 0 0 1-4.644 0 .914.914 0 0 0-.971-.401 2.752 2.752 0 0 1-3.29-3.283.914.914 0 0 0-.403-.97 2.753 2.753 0 0 1 0-4.652.914.914 0 0 0 .404-.97A2.752 2.752 0 0 1 7.71 4.42a.914.914 0 0 0 .97-.4c.25-.389.592-.709.997-.93Z' clip-rule='evenodd'/%3e%3c/g%3e%3c/svg%3e");
    --width-price-box-min: 285px;
    --width-price-box-max: 355px;

    padding: 102px 0 58px;
    background: linear-gradient(
        180deg,
        var(--color-background-gradient-start) 0%,
        var(--color-background-gradient-end) 100%
    );

    @media (prefers-color-scheme: dark) {
        background: linear-gradient(
            180deg,
            var(--color-background-gradient-start) 30%,
            var(--color-background-gradient-end) 100%
        );
    }

    ul {
        padding: 0;
        margin: 0;
    }

    h1 {
        font-weight: 500;
        font-size: 58px;
        line-height: 110%;
        text-align: center;
        color: hsl(0deg 0% 100%);
        margin: 10px;
    }

    .h1-subheader {
        font-family: var(--font-ops);
        font-weight: 400;
        font-size: 20px;
        line-height: 145%;
        text-align: center;
        font-feature-settings:
            "pnum" on,
            "lnum" on;
        color: hsl(0deg 0% 100%);
        max-width: 560px;
        padding: 0 10px;
        margin: 0 auto;

        & a {
            color: inherit;
            text-decoration: none;
            border-bottom: 1px solid hsl(0deg 0% 100% / 50%);
            transition: border 0.4s ease-out;

            &:hover {
                color: inherit;
                border-bottom: 2px solid hsl(0deg 0% 100%);
                transition: none;
            }
        }
    }

    li {
        list-style-type: none;
        display: flex;
        align-items: flex-start;
        /* Prevent flexbox from collapsing
           whitespace around links and other
           inline elements. */
        gap: 0.3em;

        &::before {
            content: "";
            height: 6px;
            width: 6px;
            border-radius: 16px;
            /* 0.5333em, roughly 8px given the
               15px font-size on list items, will
               keep the bullet vertically centered
               with the first line of a list item
               as the page's text scales. */
            margin: 0.5333em 4px 0 0;
            /* Prevent "bullets" from being distorted
               on a multiline bullet point. */
            flex: 0 0 auto;
            background: currentcolor;
            opacity: 0.3;
        }
    }

    .unlimited-push-notifications {
        padding-bottom: 21px;
    }

    .support-note {
        margin-top: 15px;
        font-size: 17px;
        font-weight: 550;

        &::before {
            /* Hide the bullet on the support note,
               but still keep its width to maintain
               lefthand alignment. */
            background: transparent;
        }
    }

    a {
        color: var(--color-link);
        text-decoration: underline;
        text-decoration-color: var(--color-link-underline);
        text-underline-offset: 4px;

        &:hover {
            color: var(--color-link-hover);
            text-decoration-color: var(--color-link-underline-hover);
        }
    }

    /* Remove padding introduced in landing_page.css */
    .padded-content {
        padding: 0;
    }

    @media (width <= 768px) {
        .pricing-model .padded-content {
            padding: 0;
        }
    }

    .pricing-container {
        display: grid;
        grid-template:
            ".       .       cloud-title  self-hosted-title .       .      " auto
            "pricing pricing pricing      pricing           pricing pricing" auto / 56px 1fr minmax(
                0,
                420px
            )
            minmax(0, 420px) 1fr 56px;
        column-gap: 2px;
        margin: 50px auto 38px;
        /* We use the plan count on the respective `.showing-` class
           to determine a maximum width, beyond which the plans will
           grow no wider. */
        max-width: calc(
            (var(--count-plans) * var(--width-price-box-max)) + 40px
        );

        @media screen and (width <= 700px) {
            grid-template-columns:
                40px 1fr minmax(0, 420px)
                minmax(0, 420px) 1fr 40px;
        }
    }

    .request-sponsorship {
        margin-bottom: 10px;
    }

    .pricing-pane-scroll-container {
        grid-area: pricing;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .cloud-plan-title {
        grid-area: cloud-title;
    }

    .self-hosted-plan-title {
        grid-area: self-hosted-title;
    }

    .pricing-tab,
    .inactive-pricing-tab {
        cursor: pointer;
        background: var(--color-background-box);
        padding: 12px 12px 0;
        border-radius: 16px 16px 0 0;
        min-height: 40px;

        h2 {
            color: var(--color-plan-tab-header);
            font-family: var(--font-ops);
            font-weight: 550;
            font-size: 30px;
            line-height: 32px;
            margin: 0;
            margin-bottom: 8px;
            text-align: center;
        }

        p {
            color: var(--color-plan-tab-copy);
            font-weight: 400;
            font-size: 16px;
            line-height: 125%;
            margin: 0;
            text-align: center;
            padding-bottom: 14px;

            @media screen and (width <= 700px) {
                display: none;
            }
        }

        /* Shared styles to handle tab curvature. */
        &::before {
            display: none;
            width: 16px;
            height: 16px;
            content: "";
            position: absolute;
            bottom: 0;
            left: -16px;
            background-color: var(--color-background-box);
            mask-position: center;
            mask-repeat: no-repeat;
            mask-image: var(--icon-left-outward-tab-curve);
        }

        &::after {
            display: none;
            width: 16px;
            height: 16px;
            content: "";
            position: absolute;
            bottom: 0;
            right: -16px;
            background-color: var(--color-background-box);
            mask-position: center;
            mask-repeat: no-repeat;
            mask-image: var(--icon-right-outward-tab-curve);
        }
    }

    .inactive-pricing-tab {
        cursor: default;
    }

    .pricing-pane {
        display: grid;
        grid-template-columns: repeat(
            auto-fit,
            minmax(var(--width-price-box-min), 1fr)
        );
        grid-template-rows: auto;
        /* We use the plan count on the respective `.showing-` class
           to determine a minimum width, at which point the plans scroll. */
        min-width: calc(var(--count-plans) * var(--width-price-box-min));
        padding: 20px;
        border-radius: 16px;
        color: var(--color-box-copy);
        background: var(--color-background-box);
        margin: 0 16px;

        @media screen and (width <= 700px) {
            margin: 0 8px;
        }

        h2 {
            font-weight: 550;
            font-size: 28px;
            line-height: 28px;
            padding-left: 14px;
            margin: 8px 0 16px;

            &.with-fine-print {
                display: flex;
                /* Keep fine-print to same distance from
                   the dashed border to the right as the
                   heading text is to the left. */
                padding: 0 14px;

                small {
                    flex: 0 1 min-content;
                    margin-left: auto;
                    font-weight: 350;
                    font-size: 14px;
                    line-height: 14px;
                    text-align: right;
                    color: var(--color-box-copy-fine-print);
                }
            }
        }

        ul {
            font-family: var(--font-ops);
            font-weight: 400;
            font-size: 15px;
            line-height: 21px;
        }

        li {
            margin-bottom: 10px;
        }

        .price-box {
            height: 100%;
            display: flex;
            flex-direction: column;
            border-right: 1px dashed hsl(223deg 40% 25% / 20%);

            &:last-child {
                border-right: 0;
            }

            /* Make sure flexing text-content boxes
               occupy their full with, but account
               for padding with border-box sizing. */
            .text-content {
                box-sizing: border-box;
                width: 100%;
                margin: 0 auto;
            }

            /* Set right and left padding on the
               bottom box so that buttons align
               to the text column above. */
            .bottom {
                padding: 0 16px;
            }
        }

        .text-content {
            padding: 0 16px;
        }

        .bottom {
            /* Push to the bottom of the price box. */
            margin-top: auto;
        }

        .standard-price-box {
            display: flex;
            /* Handle a discount line, when
               needed. */
            flex-wrap: wrap;
            align-items: flex-start;
            gap: 4px;
            min-height: 56px;
            margin-top: 24px;

            .price {
                font-size: 38px;
                line-height: 1;
                letter-spacing: -1px;
            }

            .currency-symbol {
                opacity: 0.5;
            }

            .details {
                flex: 1 0 0;

                p {
                    margin: 2px 0 0;
                    font-size: 15px;
                    line-height: 17px;
                }

                &.singular-billing-frequency {
                    align-self: flex-end;
                    margin-bottom: 5px;
                }
            }

            .discount {
                /* Keep the discount to its own
                   line in the wrapping flexbox. */
                flex: 0 0 100%;
                text-align: center;
                padding: 1px 0 6px;
                margin-bottom: -5px;
                border-radius: 4px 4px 0 0;
                background-color: hsl(0deg 0% 85%);
            }

            .price,
            .details {
                &.no-discount {
                    /* Pad prices that do not have
                       a discount (e.g., Free, or a
                       customer's current plan). */
                    padding-bottom: 25px;
                }
            }
        }
    }

    .additional-pricing-information {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto;
        column-gap: 32px;
        max-width: 912px;
        margin: 0 auto;

        @media screen and (width <= 810px) {
            grid-template-columns: minmax(0, 456px);
            justify-content: center;
            row-gap: 32px;
        }

        header {
            position: relative;
            padding: 0 16px 0 32px;

            &::before {
                display: block;
                content: "";
                width: 32px;
                height: 56px;
                position: absolute;
                background-color: hsla(210deg 44% 92%);
                top: 30px;
                left: -0.5px;
                mask-position: center;
                mask-repeat: no-repeat;
                mask-image: var(--icon-question-header-swoosh);
            }

            h2 {
                font-family: var(--font-ops);
                font-weight: 500;
                font-size: 30px;
                line-height: 38px;
                margin: 0;
            }

            p {
                font-weight: 400;
                font-size: 16px;
                margin: 0;
                margin-bottom: 6px;
            }

            a {
                color: inherit;
                text-decoration-color: var(--color-link-underline-alternate);

                &:hover {
                    text-decoration-color: var(
                        --color-link-underline-alternate-hover
                    );
                }
            }
        }

        .text-content {
            color: var(--color-box-copy);
            background: var(--color-background-box);
            padding: 20px 32px;
            border-radius: 16px;

            b {
                font-weight: 600;
            }
        }

        h3 {
            margin: 0 0 6px;
            font-weight: 500;
            font-size: 22px;
            line-height: 28px;
        }

        ul {
            margin-bottom: 12px;
        }

        li {
            font-size: 15px;
            margin-bottom: 4px;
        }

        p {
            margin: 0;
        }

        .sponsorship-button {
            display: block;
            font-weight: 550;
            font-size: 15px;
            line-height: 20px;
            text-align: center;
            padding: 8px 10px;
            margin-bottom: 6px;
        }

        .contact-note {
            font-weight: 400;
            font-size: 14px;
        }
    }

    @media screen and (width <= 500px) {
        .additional-pricing-information {
            margin: 0 8px;

            header {
                padding-bottom: 29px;
            }

            p {
                display: none;
            }
        }
    }

    .button {
        display: block;
        font-family: var(--font-ss3);
        font-weight: 550;
        font-size: 15px;
        text-align: center;
        text-decoration: none;
        letter-spacing: 0.06ch;
        padding: 8px 10px;
        border-radius: 4px;
        /* Position relatively for discount tab */
        position: relative;
        z-index: 5;
    }

    .button-placeholder {
        /* Empty element for maintaining the
           layout on plans that otherwise have
           no button. */
        height: 37.5px;
        visibility: hidden;
    }

    .get-started-button {
        color: hsl(0deg 0% 100%);
        background-color: hsl(146deg 92% 26%);

        &:hover {
            color: hsl(0deg 0% 100%);
            background-color: hsl(146deg 92% 24%);
        }
    }

    .upgrade-button {
        color: hsl(0deg 0% 100%);
        background-color: hsl(219deg 62% 54%);

        &:hover {
            color: hsl(0deg 0% 100%);
            background-color: hsl(219deg 62% 50%);
        }
    }

    .current-plan-button,
    .current-plan-descriptor {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5ch;
        color: hsl(147deg 57% 25%);
        background-color: hsl(152deg 79% 24% / 5%);

        .current-plan-icon {
            width: 22px;
            height: 22px;
            display: block;
            background-color: currentcolor;
            mask-position: center;
            mask-repeat: no-repeat;
            mask-image: var(--icon-current-plan-icon);
        }
    }

    .current-plan-descriptor {
        /* Pad and lead the descriptor
           to better match other buttons */
        padding: 1.75px 0;
        line-height: 16px;
        background-color: transparent;
        border: 1px solid hsl(152deg 79% 24% / 10%);
        font-weight: normal;
    }

    .current-plan-button:hover {
        color: hsl(147deg 57% 25%);
        background-color: hsl(152deg 79% 24% / 14%);
    }

    .sponsorship-button {
        color: hsl(147deg 57% 25%);
        background-color: hsl(152deg 79% 24% / 10%);

        &:hover {
            color: hsl(147deg 57% 25%);
            background-color: hsla(146deg 92% 24% / 15%);
        }
    }

    &.showing-cloud {
        --count-plans: 3;

        .self-hosted-scroll,
        .self-hosted-plan-pricing,
        .self-hosted-additional-pricing {
            display: none;
        }

        .cloud-plan-title {
            position: relative;

            /* Show curvature on cloud tab. */
            &::before {
                display: block;
            }

            &::after {
                display: block;
            }

            p {
                border-bottom: 1px dashed hsl(223deg 40% 25% / 20%);
                margin: 0 10px;
            }

            @media screen and (width <= 700px) {
                h2 {
                    border-bottom: 1px dashed hsl(223deg 40% 25% / 20%);
                    height: 100%;
                    margin: 0 10px;
                }
            }

            @media screen and (width <= 500px) {
                h2 {
                    margin: 0;
                }
            }
        }

        .self-hosted-plan-title {
            border-radius: 16px 16px 0 14px;
            margin-bottom: 2px;
            background-color: var(--color-background-box-muted);
        }
    }

    &.showing-self-hosted {
        --count-plans: 4;

        .cloud-scroll,
        .cloud-plan-pricing,
        .cloud-additional-pricing {
            display: none;
        }

        .cloud-plan-title {
            border-radius: 16px 16px 14px 0;
            margin-bottom: 2px;
            background-color: var(--color-background-box-muted);
        }

        .self-hosted-plan-title {
            position: relative;

            /* Show curvature on self-hosted tab. */
            &::before {
                display: block;
            }

            &::after {
                display: block;
            }

            p {
                border-bottom: 1px dashed hsl(223deg 40% 25% / 20%);
                margin: 0 10px;
            }

            @media screen and (width <= 700px) {
                h2 {
                    border-bottom: 1px dashed hsl(223deg 40% 25% / 20%);
                    height: 100%;
                    margin: 0 10px;
                }
            }

            @media screen and (width <= 500px) {
                h2 {
                    margin: 0;
                }
            }
        }
    }

    .is-self-hosted-realm {
        /* Don't display buttons on cloud plans
           when viewed by self-hosters. */
        .cloud-plan-pricing .bottom .text-content {
            display: none;
        }
    }

    @media screen and (width <= 940px) {
        h1 {
            font-size: 40px;
        }

        .h1-subheader {
            font-size: 16px;
        }

        .pricing-tab h2 {
            font-size: 24px;
            line-height: 26px;
            margin-bottom: 0;
        }

        .pricing-pane h2 {
            font-size: 22px;
            margin: 4px 0 12px;
        }
    }

    @media screen and (width <= 900px) {
        .additional-pricing-information header h2 {
            font-size: 24px;
        }
    }

    @media screen and (width <= 500px) {
        .pricing-tab h2 {
            font-size: 20px;
        }
    }
}
